<script type="text/javascript">

$(document).ready(function() {
	
		var date = new Date();
		var d = date.getDate();
		var m = date.getMonth();
		var y = date.getFullYear();
		
		$('#calendar').fullCalendar({
			theme: true,
			header: {
				left: 'prev,next today',
				center: 'title',
				right: 'month,agendaWeek,agendaDay'
			},
			editable: true,
			events: [
            <?php 
                foreach ($felist as $event)
                { ?>
				{
					title: '<?php echo $event['Job']['title'];?>',
					start: '<?php echo $event['Job']['sdate'] . ' ' . $event['Job']['stime'];?>',
                    <?php if($event['Job']['sdate'] == $event['Job']['edate']){ echo 'allDay: false'; } 
                    else {echo 'end: \'' . $event['Job']['edate'] . '\''; }?>,
                    
                    url: '<?php echo '/jobs/jdetail/' . $event['Job']['id'];?>',
                    }
				,
                <?php } ?>
			{} // This empty record is to close the Event Array after the for-each is done. The last record should not have a comma following it
                ]
		});
		
	});
    
</script>